package sanyueer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[]array={"1","2","3","4","5"};
        for (int i=0;i< array.length;i++){
            System.out.println(array[i]);
        }
        for (String str:array){
            System.out.println(str);
        }
        Collection c=new ArrayList();
        c.add("1");
        c.add("2");
        c.add("3");
        c.add("4");
        c.add("5");
        Iterator it=c.iterator();
        while (it.hasNext()){
            String str=(String) it.next();
            System.out.println(str);
        }
        for (Object obj:c){
            String str=(String)obj;
            System.out.println(str);
        }
    }
}
